﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Server.Model;
using Server.DB;

namespace Server.Controller
{
    class ReservationController : IReservationController
    {
        //ReservationRepository ReservationRep;
        IRepository<Reservation> ReservationRepository;
        
        public ReservationController(Context db)
        {
            //ReservationRep = new ReservationRepository(db);
            ReservationRepository = new Repository<Reservation>(db);
        }

        public ICollection<Reservation> GetActiveReservationsByUserDate(Model.User user, DateTime date)
        {
            //return ReservationRep.GetActiveReservationsByUserDate(user, date).ToList();
            return ReservationRepository.SearchFor(r => r.User.Id.Equals(user.Id) && r.Date >= date).ToList();
        }
    }
}
